//
// Created by HhL on 2020/12/23.
//

#include "com_hhl_jni_threadpool_MyThreadPool.h"
#include "common.h"
#include "thread_pool.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <assert.h>

/*
 * Class:     com_hhl_jni_threadpool_MyThreadPool
 * Method:    init
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_com_hhl_jni_threadpool_MyThreadPool_init(JNIEnv *jEnv, jobject jobj, jint minSize, jint maxSize) {
    if (0 != thread_pool_init(jEnv, minSize, maxSize)) {
        throwRuntimeException(jEnv, "初始化线程池失败");
        return;
    }
}


/*
 * Class:     com_hhl_jni_threadpool_MyThreadPool
 * Method:    destroy
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_com_hhl_jni_threadpool_MyThreadPool_destroy(JNIEnv *jEnv, jobject jobj) {
    thread_pool_destroy();
}
